home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 151-175 / disk_166 / multicalc / multicalc.doc < prev    next >
Text File  |  1992-05-06  |  16KB  |  368 lines

  1. #1z
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                                   MultiCalc 1.0
  30.  
  31.                              A Precision Calculator
  32.  
  33.                                      for the
  34.  
  35.                                  Commodore AMIGA
  36.  
  37.                                 November 1,  1988
  38.  
  39.                                  Kenneth Johnson
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.           Introduction
  47.  
  48.                The purpose of this document is to describe the features
  49.           of MultiCalc 1.0 and  help the  user make  the most  of them.
  50.           This program originated as an exercise in curiosity - both in
  51.           terms of the methods used to  compute the  standard functions
  52.           on a scientific calculator and with regard to the features of
  53.           the AMIGA.    I  have  never  seen  a  high-precision general
  54.           purpose calculator on a computer, and I thought it might be a
  55.           useful addition to AMIGA public domain programs as  well as a
  56.           good first project for myself.
  57.  
  58.                MultiCalc 1.0  is not  blazingly fast.   It is optimized
  59.           for doing operations with  precision from  50 to  around 3000
  60.           digits.   However, dealing  with numbers this large is always
  61.           slow, and this program is no  exception.   The slowest opera-
  62.           tions are those involving inverse trigonometric functions:  I
  63.           would not recommend using these functions with precision over
  64.           100 unless  you have plenty of time to wait.  The program can
  65.           handle numbers of any size up to 32000  digits.   If you need
  66.           greater precision than this, I would recommend buying time on
  67.           a supercomputer!
  68.  
  69.                In designing the program I opted to use a Reverse Polish
  70.           Notation  (RPN)  stack-based  format.    Memory  is allocated
  71.           dynamically, so your stack size is only limited by the amount
  72.           of  available  memory.    If  you are not familiar with stack
  73.           based calculators, the concept is quite  simple:   all opera-
  74.           tions are  computed on  the numbers  at the top of the stack,
  75.           and the <Enter> key is used  to place  numbers on  the stack.
  76.           There is an indicator at the top of the display that indicat-
  77.           ing the current depth  of the  stack.   I have  implemented a
  78.           circular stack  - the  number shown  in the display is always
  79.           the top of the stack.  Moving down places the top item at the
  80.           bottom of  the stack, and moving up places the bottom item at
  81.           the top of the stack.
  82.  
  83.                I hope that this program will be useful.   It  is fairly
  84.           compact, requiring  only 24K  of Chip  memory, and  I used an
  85.           adaptation of Leo Schwab's iconify routine so that  it can be
  86.           loaded without cluttering the screen when not in use.  Still,
  87.           it is far from perfect, and  suggestions for  improvement are
  88.           always welcome.  Please address any correspondence to:
  89.  
  90.                     Kenneth Johnson
  91.                     3018 Trail's End NW
  92.                     Albuquerque, NM  87120
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.           Getting Started
  100.  
  101.                MultiCalc 1.0  can be  started from either the Workbench
  102.           or CLI.   The program takes one optional argument, namely the
  103.           numeric precision.  This can be any number from 20 to  32000;
  104.           anything else will result in the default precision of 48 (the
  105.           size of the display).  A sample call is as follows:
  106.  
  107.             1> MultiCalc 500
  108.  
  109.           This would  bring up  the calculator  with a precision of 500
  110.           digits.  Keep in  mind that  you cannot  change the precision
  111.           once the  program has started, so if you will be dealing with
  112.           very large or very small numbers,  you should  set the preci-
  113.           sion accordingly.
  114.  
  115.                When running from the Workbench, it is only necessary to
  116.           double-click on the MultiCalc 1.0 icon.   The  precision will
  117.           default to  48, but it can be set with a Tool Type entry.  To
  118.           make this entry, select  the  icon  from  Workbench  and then
  119.           selct the  Info item  from the  Workbench menu.  You can then
  120.           ADD a Tool Type entry as follows:
  121.  
  122.                PRECISION=500
  123.  
  124.           This  entry  would  set  the  calculator's  precision  to 500
  125.           digits.    Finally,  you  must  press  the SAVE gadget on the
  126.           bottom left corner of the Info window.  It is  important that
  127.           the entry  be made in capital letters and without any spaces.
  128.           Once this is done,  double-clicking  on  the  calculator icon
  129.           will bring up MultiCalc 1.0 with the desired precision.
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.           Entering Numbers and Using the Stack
  137.  
  138.                Almost every  feature of  MultiCalc 1.0  can be accessed
  139.           either with the  mouse  or  the  keyboard.    Numbers  can be
  140.           entered with  the mouse  by clicking on the number gadgets in
  141.           the calculator window, using the  left  mouse  button.   Each
  142.           click is  registered upon  releasing the  mouse button, so if
  143.           you change  your mind  about a  digit, simply  move the mouse
  144.           away  from  the  gadget  before  releasing  the button.  If a
  145.           mistake is made in  entering a  number, the  BackSpace gadget
  146.           can be used to remove one digit at a time.
  147.  
  148.                Using  the  keyboard,  the  digits  can be entered using
  149.           either the numeric keypad or the  regular typewriter numbers.
  150.           The space  bar is  used to change the sign of the number, and
  151.           the BACK SPACE key is used to back  up one  digit at  a time.
  152.           Keep  in  mind  while  backspacing that the decimal point (.)
  153.           will "absorb" a back space, even though the  display will not
  154.           change when this happens.
  155.  
  156.                The <RETURN> and <ENTER> keys are used to add numbers to
  157.           the stack.  When either is  pressed, the  number currently in
  158.           the display  is duplicated and placed on top of the stack, so
  159.           that a number can easily be entered many times.   However, if
  160.           any  digit  is  pressed  at  this  point, the display will be
  161.           initialized and a new number will be started.  In  this case,
  162.           BACK SPACE  has the same function as the Clear button ('c' on
  163.           the keyboard):  the display  is  cleared  and  initialized to
  164.           zero.    However,  the  Change  Sign button (space bar on the
  165.           keyboard) will not initialize the display - it merely changes
  166.           the sign of the current entry.
  167.  
  168.                If the  number is  larger that the display, the left and
  169.           right arrow keys can be used to shift the display to the left
  170.           and right,  respectively.  Also, the SHIFT key can be used in
  171.           conjunction with the arrow keys on the keyboard  to shift the
  172.           display to the left and right ends of the number.  The up and
  173.           down arrow keys are  used to  rotate through  the contents of
  174.           the  stack.    The  Swap  button  (HELP  key on the keyboard)
  175.           switches the places of the top two entries of the stack.
  176.  
  177.                If a number  key  is  pressed  after  using  any  of the
  178.           arithmetic, function, or stack-manipulation keys, a new entry
  179.           is  added  to  the  stack  automatically,  and  the preivious
  180.           contents of  the display  are preserved as the second item on
  181.           the stack.  However, the BACK SPACE and  Clear buttons retain
  182.           their function  of merely  resetting the  contents of current
  183.           display entry to zero.
  184.  
  185.                Finally, the Delete button (SHIFT-DEL from the keyboard)
  186.           is used  to remove an entry from the stack.  If there is only
  187.           one entry on the  stack,  this  button  acts  like  the Clear
  188.           button.
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.           Use of Function Keys
  196.  
  197.                All  of  the  arithmetic  and  other  function  keys are
  198.           available from both mouse and  keyboard.    For  the keyboard
  199.           equivalents,  please  see  the  Summary of Keyboard Functions
  200.           below.  There are some special considerations with  regard to
  201.           a  few  of  these  functions,  and these are detailed in this
  202.           section.
  203.  
  204.                First, it is important to keep  in mind  that all binary
  205.           operations use  the two  numbers on the top of the stack.  In
  206.           some cases, the order  of these  numbers is  important.  When
  207.           using the  division operator,  the divisor is taken to be the
  208.           number on the top of the  stack.   In raising  a number  to a
  209.           power,  the  power  is  the  number  on top.  Finally, Rectal
  210.           coordinates are stored with  the y  coordinate on  top, while
  211.           Polar coordinates are stored with the angle on top.
  212.  
  213.                There are  three buttons  that define how the calculator
  214.           will deal with the  trigonometric  functions.    Unlike other
  215.           buttons on  the calculator,  these three register a change as
  216.           soon as the mouse button is  pressed, instead  of when  it is
  217.           released.  First, the Radians/Grads/Degrees button is used to
  218.           define the unit  of  angle  measurement.    This  affects the
  219.           trigonometric functions  (except when  in Hyperbolic mode) as
  220.           well as the Polar to Rectal and Rectal  to Polar conversions.
  221.           The default  mode is Radians, so be aware of this if you need
  222.           to use something else.
  223.  
  224.                The Trigonometric/Hyperbolic  and Normal/Inverse buttons
  225.           only affect  the outcome of the Trigonometric functions.  The
  226.           default is Normal-Trigonometric, and the calculator is always
  227.           returned to this state after a Trigonometric operation.
  228.  
  229.                Finally, the  Fix button is used to restrict the display
  230.           to a specified number of digits after the decimal point.   It
  231.           is important  to keep in mind that this does not truncate the
  232.           number in any way - only the display of the number is affect-
  233.           ed.   To use  this feature, simply enter the number of digits
  234.           desired and press the Fix button.  The  display will  then be
  235.           cleared and  ready to  accept input  for another number.  Any
  236.           fractional portion is ignored  when using  this function, and
  237.           the  number  zero  is  used  to signify a full display.  When
  238.           entering numbers in this mode,  it  is  possible  to continue
  239.           entering digits past the cutoff.  These will not be seen, but
  240.           can nevertheless be edited in the standard way.
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.           The Menu
  248.  
  249.                The menu  provides several  additional non-numeric func-
  250.           tions to  the calculator.   The  'About...' item does nothing
  251.           especially  useful,  but  gives  some  information  about the
  252.           product.   The 'Delimited'  flag pertains to the 'Save Stack'
  253.           item and will be discussed with it below.
  254.  
  255.                The  'Iconify'  item  causes  the  calculator  window to
  256.           disappear and  a small  icon to take its place.  My thanks to
  257.           Leo Schwab for providing  the inspiration  for and  the basic
  258.           form of  the routine  that takes care of this function.  This
  259.           icon can then be moved around the display, and out of the way
  260.           of  other  activities.    In  order  to reopen the calculator
  261.           window, simply double-click on the icon.
  262.  
  263.                The 'Load Stack' item will fill  the stack  with numbers
  264.           that are  stored in ASCII form in a file.  Most commonly this
  265.           will be used to restore numbers saved using  the 'Save Stack'
  266.           item, but  it can  also be  used in conjunction with any text
  267.           editor to load any numbers of  your choice  into the calcula-
  268.           tor.   Invoking this option will bring up a requester for the
  269.           name of the file from which  to  load  the  numbers.   Simply
  270.           click on  the box to enter the name of the file, and click on
  271.           the 'Accept' gadget to initiate the load.
  272.  
  273.                The 'Save Stack' item  takes the  contents of  the stack
  274.           and saves  them in  a file.  The procedure is similar to that
  275.           involved in 'Load Stack'  above.    However,  the 'Delimited'
  276.           item in  the menu  can be  selected or deselected to indicate
  277.           whether you want your  output to  be delimited  by commas and
  278.           spaces.   Also, if the file already exists, the current stack
  279.           will be appended to the end of its contents, otherwise  a new
  280.           file will be created.
  281.  
  282.                The 'Quit'  option does  just what its name implies - it
  283.           terminates the  program.   Keep in  mind that  several of the
  284.           menu  items  can  be  invoked with their keyboard equivalents
  285.           using the Right-Amiga key.
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.           Summary of Keyboard Functions
  293.  
  294.           *                   Multiplication
  295.           /                   Division
  296.           +                   Addition
  297.           -                   Subtraction
  298.           SPACE               Change Sign
  299.           c                   Clear Display
  300.           BACK SPACE          Delete a Digit
  301.           SHIFT-DEL           Delete a Number from the Stack
  302.           RETURN              Add a Number to the Stack
  303.           ENTER               Add a Number to the Stack
  304.  
  305.           HELP                Swap the Top Two Stack Entries
  306.           Up Arrow            Rotate the Stack Up
  307.           Down Arrow          Rotate the Stack Down
  308.           Left Arrow          Shift the Display to the Left
  309.           Right Arrow         Shift the Display to the Right
  310.           SHIFT-Left Arrow    Shift the Display to the Left End
  311.           SHIFT-Right Arrow   Shift the Display to the Right End
  312.  
  313.           ESC                 Rotate Radians/Grads/Degrees
  314.           F5                  Rotate Trigonometric/Hyperbolic
  315.           F10                 Rotate Normal/Inverse
  316.  
  317.           F1                  Log Base 10
  318.           F2                  Log Base e
  319.           F3                  10 Raised to a Power
  320.           F4                  e Raised to a Power
  321.           F6                  Sin/Sinh/ArcSin/ArcSinh
  322.           F7                  Cos/Cosh/ArcCos/ArcCosh
  323.           F8                  Tan/Tanh/ArcTan/ArcTanh
  324.           F9                  Pi
  325.  
  326.           SHIFT-F1            Reciprocal
  327.           SHIFT-F2            Square a Number
  328.           SHIFT-F3            Raise a Number to a Power
  329.           SHIFT-F4            Raise a Number to a Reciprocal Power
  330.           SHIFT-F6            Change Rectal to Polar
  331.           SHIFT-F7            Change Polar to Rectal
  332.           SHIFT-F8            Fix the Number of Decimal Digits
  333.           SHIFT-F9            Factorial
  334.  
  335.           Amiga-I             Iconify
  336.           Amiga-L             Load the Stack from a File
  337.           Amiga-S             Save the Stack to a File
  338.           Amiga-Q             Exit the Program
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.           Copyright Notice
  346.  
  347.                MultiCalc is copyright 1988  by  Kenneth  Johnson.   The
  348.           binary code  may be distributed free of charge in any form as
  349.           long as this document is included  with it.   Special permis-
  350.           sion must  be obtained to distribute MultiCalc for a fee, and
  351.           this permission  is  extended  to  all  not-for-profit User's
  352.           Groups to  defray copy  and distribution costs, as well as to
  353.           those distributing collections of  AMIGA public  domain soft-
  354.           ware.
  355.  
  356.                If you  find that  MultiCalc 1.0 is particularly useful,
  357.           or if you have  any questions,  comments, or  suggestions for
  358.           future  improvements,  or  if  you  would  like a copy of the
  359.           source code, donations  and  other  correspondence  should be
  360.           addressed to:
  361.  
  362.                     Kenneth Johnson
  363.                     3018 Trail's End NW
  364.                     Albuquerque, NM  87120
  365.  
  366.                Enjoy!
  367.  
  368. c